<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/page/base.jsp"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="d" uri="/doone-comm-ui-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<link type="text/css" href="<%=path%>/manage/css/new_style.css"
	rel="stylesheet" />
<link type="text/css" href="<%=path%>/manage/css/push_style.css"
	rel="stylesheet" />
<link type="text/css" href="<%=path%>/manage/css/layout.css"
	rel="stylesheet" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/manage/css/Tooltip.css" />
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/easyTooltip.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery-ui-1.8.11.custom.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.wysiwyg.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/hoverIntent.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/superfish.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/custom.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery-ui-1.8.11.custom.min.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/Tooltip.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.validate.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.validate.methods.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.validate.defaults.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/My97DatePicker/WdatePicker.js"></script>
<!-- End of Libraries -->
<script type="text/javascript">
	function delMessage(messageId, flag) {
		var url = "${pageContext.request.contextPath}/push/delPushMessage.action?messageId="
				+ messageId;
		if (flag == 0) {
			alert("此条推送消息已发送不能删除");
			return;
		}
		window.location.href = url;
	}
</script>
</head>

<body>
	<div>
		<p class="sitemap">当前位置：内容管理 > 消息推送管理</p>
		<h1>消息推送管理</h1>
		<div>
			<div id="tabs">
				<ul>
					<li><a href="#tabs-1">消息列表</a></li>

				</ul>
				<div id="tabs-2">
					<a href='<%=path%>/push/addPushMessage.action' class="btn_addnew">新增消息</a>
					<table class="fullwidth" cellpadding="0" cellspacing="0" border="0">
						<thead>
							<tr>
								<td>推送消息</td>
								<td>状态</td>
								<td>发送时间</td>
								<td>失效时间</td>
								<td>操作</td>
								<td>发送群组</td>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="message" items="${msgList}" varStatus="index">
								<tr <c:if test="${index.count%2!=0}">class="odd"</c:if>>
									<td>
										<table class="sub_table">
											<tr>
												<td><span class="name_bold">${message.title}</span></td>
											</tr>
											<tr>
												<td><span class="gray_bar"> <c:if
															test="${fn:length(message.summary)>20 }">
														       	${fn:substring(message.summary,0,20)}..															
															</c:if> <c:if test="${fn:length(message.summary)<20 }">
															${message.summary }
														</c:if>
												</span></td>
											</tr>
											<tr>
												<td class="green_bar">发出推送： <a
													href="javascript:void(0);">${ message.pushCount}</a> 发送成功：
													<a href="javascript:void(0);">${message.flag eq 0 ?
														message.sendCount : 0 }</a> 已查看： <a href="javascript:void(0);">${message.viewCount
														}</a>
												</td>
											</tr>
										</table>
									</td>
									<td><c:if test="${message.flag eq 0 }">
											<span class="sendok">发送成功</span>
										</c:if> <c:if test="${message.flag eq 1 }">
											<span class="unsend">待发送</span>
										</c:if></td>
									<td><fmt:formatDate value="${message.startTime }"
											pattern="yyyy-MM-dd HH:mm:ss" /></td>
									<td><fmt:formatDate value="${message.expireTime }"
											pattern="yyyy-MM-dd HH:mm:ss" /></td>
									<td><c:if test="${message.flag eq 0 }">
											<a class="icon icon_preview" title="预览"
												href="<%=path%>/push/editMessage.action?id=${message.id}"></a>
										</c:if> <c:if test="${message.flag eq 1 }">
											<a class="icon icon_edit" title="编辑 "
												href="<%=path%>/push/editMessage.action?id=${message.id}">
											</a>
											<a class="icon icon_delete" title="删除"
												href="javascript:delMessage(${message.id},${message.flag })"></a>
										</c:if></td>
									<td><c:if test="${fn:length(message.searchCondition)>20 }">
														       	${fn:substring(message.searchCondition,0,20)}..															
															</c:if> <c:if test="${fn:length(message.searchCondition)<20 }">
															${message.searchCondition }
														</c:if></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<div align="right" style="float: right;">
						<d:page id="page" template="details" skin="gray">
						</d:page>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
